﻿<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>微信公众号添加</title>
<link rel="stylesheet" href="/scriptZIP/layui.min.css">
	<link rel="stylesheet" href="css/common2.css">
	<link rel="stylesheet" href="../css/layui.css" />
	<link rel="stylesheet" href="/scriptZIP/vue-select.min.css">
	<style>
		.layui-row {
			margin-top: 50px;
		}

		.offer {
			width: 90px;
			height: 35px;
			background: #0086b6;
			color: white;
			text-align: center;
			line-height: 35px;
			font-size: 16px;
			border-radius: 4px;
		}

		.return {
			width: 80px;
			height: 35px;
			background: #0086b6;
			color: white;
			text-align: center;
			line-height: 35px;
			margin-top: -35px;
			margin-left: 130px;
			font-size: 16px;
			border-radius: 4px;
		}


		[v-if] {
			display: none;
		}

		.vs--searchable .vs__dropdown-toggle {
			width: 70%;
			background-color: white;
			height: 36px;
		}

		ul[role="listbox"] {
			width: 70%;
			margin-left: 25px;
		}
	</style>
</head>

<body>
	
	<div class="layui-row" id="vue-root">
		<div></div>
		<div class="layui-col-md6 layui-col-md-offset3">
			<div class="layui-form-item">
				<label class="layui-form-label">公众号名称</label>
				<div class="layui-input-block">
					<input name="wechatPlatformName" v-validate="'required'" autocomplete="off" placeholder="请输入公众号名称"
						class="layui-input name" v-model="item.name">
					<div class="checkout_state" v-text="err('wechatPlatformName')"></div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">联系人</label>
				<div class="layui-input-block">
					<input name="linkman" v-validate="'required'" autocomplete="off" placeholder="请输入联系人"
						class="layui-input name" v-model="item.linkman">
					<div class="checkout_state" v-text="err('linkman')"></div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">联系人手机号</label>
				<div class="layui-input-block">
					<input name="phone" v-validate="'phone'" autocomplete="off" placeholder="请输入联系人"
						class="layui-input name" v-model="item.phone">
					<div class="checkout_state" v-text="err('phone')"></div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">到期时间</label>
				<div class="layui-input-block">
					<input type="text" class="layui-input" id="test3" v-model="item.expiryDate" placeholder="请输入结束时间">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">AppID</label>
				<div class="layui-input-block">
					<input name="AppID" v-validate="'required'" autocomplete="off" placeholder="请输入AppID"
						class="layui-input tag" v-model="item.appId">
					<div class="checkout_state" v-text="err('AppID')"></div>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">AppSecret</label>
				<div class="layui-input-block">
					<input name="AppSecret" v-validate="'required'" autocomplete="off" placeholder="请输入AppSecret"
						class="layui-input appSecret" v-model="item.appSecret">
					<div class="checkout_state" v-text="err('AppSecret')"></div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">微信支付<br>商户号</label>
				<div class="layui-input-block">
					<input name="mchId" autocomplete="off" placeholder="请输入商户号" class="layui-input tag"
						v-model="item.mchId">
					<div class="checkout_state" v-text="err('mchId')"></div>
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">微信支付<br>签名密钥</label>
				<div class="layui-input-block">
					<input name="key" autocomplete="off" placeholder="请输入密钥" class="layui-input tag" v-model="item.key">
					<div class="checkout_state" v-text="err('key')"></div>
				</div>
			</div>


			<div class="layui-form-item" v-if="isAdmin">
				<label class="layui-form-label">代理商</label>
				<div class="layui-input-block">
					<v-select multiple placeholder="请选择代理商" label="name" :options="agents" :reduce="item=>item.id"
						v-model="item.agentIds"></v-select>
				</div>
			</div>

			<div class="layui-form-item">
				<div class="layui-input-block">
					<div class="offer" @click="submit1">立即提交</div>
					<div class="return" onclick="history.back()">取消</div>
				</div>
			</div>
		</div>

	</div>


	<script src="/scriptZIP/qs.min.js"></script>
	<script src="/scriptZIP/vue.min.js"></script>
	
	
	<script src="/scriptZIP/axios.min.js"></script>
	<script src="/scriptZIP/vue-select.min.js"></script>
	<script src="/lib/laydate/laydate.js"></script>

	<script src="/js/common.js"></script>
	<script src="/js/item.js"></script>

	<script>

		Vue.component('v-select', VueSelect.VueSelect);
		var app = new Vue(merge({
			data: {
				url: '/pc/wechatPlatform',
				agents: [],
				isAdmin: false
			},
			created: function () {
				this.init();
				this.isAdmin = !/agent/.test(top.location.href);
				if (this.isAdmin) {
					axios.get('/pc/agent/all').then(function (res) {
						this.agents = res.data;
					}.bind(this));
				}
			},
			methods: {
				submit1: function () {
					if (!this.isAdmin)
						this.item.agentId = top_params().id;
					this.submit();
				}
			}
		}));

		laydate.render({
			elem: '#test3',
			type: 'date',
			done: function (value, date, endDate) {
				app.item.expiryDate = value;
			}
		});

	</script>

</body>

</html>